﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="QuanLyQuangCao.ascx.cs" Inherits="Admin_UserControl_QuanLyQuangCao" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>



<style type="text/css">
    .style1
    {
        height: 24px;
    }
</style>

<table border="1" cellspacing="0" cellpadding="0" width="100%">
    <tr>
        <td class="style1" align="center" colspan="5" style="color: #FFFFFF; background-color: #7D7D7D; font-style: normal; font-weight: bold; font-size: x-large">
       
            Quản lý các vị trí quảng cáo</td>
    </tr>
    <tr>
        <td class="style1" align="center">
       
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
              Loại quảng cáo:
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
                DataSourceID="SqlDataSource3" DataTextField="TenLoaiViTri" 
                DataValueField="MaViTri" 
                    onselectedindexchanged="DropDownList1_SelectedIndexChanged">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                SelectCommand="SELECT [TenLoaiViTri], [MaViTri] FROM [VI_TRI_QUANG_CAO]">
            </asp:SqlDataSource>
            </ContentTemplate>
            </asp:UpdatePanel>
       
          
           
        </td>
        <td class="style1">
            <asp:Button ID="btnAn" runat="server" onclick="btnAn_Click" Text="Ẩn" CssClass="exclusive" Width="50"/>
        </td>
        <td class="style1">
            <asp:Button ID="btnXoa" runat="server" onclick="btnXoa_Click" Text="Xóa" CssClass="exclusive" Width="50"/>
        </td>
        <td class="style1">
            <asp:Button ID="btnSua" runat="server" Text="Sửa" onClick="btnSua_Click" CssClass="exclusive" Width="50"/>
            </asp:Button>
        </td>
        <td class="style1">
            <asp:Button ID="btnHienPanelThem" runat="server" Text="Thêm" onClick="btnThem_Click" CssClass="exclusive" Width="50"></asp:Button>
        </td>
    </tr>
    <tr>
        <td colspan="5" align="center">
            <asp:UpdatePanel ID="UpdatePanel3" runat="server">
            <ContentTemplate>
           
            <asp:Panel runat="server" ID="pnlChiTietLoaiQuangCao" 
                ClientID="pnlChiTietLoaiQuangCao" Visible="False" HorizontalAlign="Center">
              
                <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BackColor="White"
                    BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" 
                    CellPadding="3" DataSourceID="SqlDataSource1"
                    ForeColor="Black" GridLines="Vertical" Height="50px" OnPageIndexChanging="DetailsView1_PageIndexChanging1"
                    Width="336px" DataKeyNames="MaViTri">
                    <FooterStyle BackColor="#CCCCCC" />
                    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                    <Fields>
                        <asp:BoundField DataField="MaViTri" HeaderText="MaViTri" InsertVisible="False" 
                            ReadOnly="True" SortExpression="MaViTri" Visible="False" />
                        <asp:BoundField DataField="TenLoaiViTri" HeaderText="Tên vị trí quảng cáo" 
                            SortExpression="TenLoaiViTri" />
                        <asp:BoundField DataField="Width" HeaderText="Width" SortExpression="Width" />
                        <asp:BoundField DataField="Heigth" HeaderText="Heigth" SortExpression="Heigth" />
                        <asp:BoundField DataField="ThoiGianLuanChuyen" HeaderText="Thời gian luân chuyển"
                            SortExpression="ThoiGianLuanChuyen" />
                        <asp:BoundField DataField="TienQuangCao" HeaderText="Tiền quảng cáo" 
                            SortExpression="TienQuangCao" />
                        <asp:CheckBoxField DataField="Deleted" HeaderText="Deleted" SortExpression="Deleted" />
                        <asp:BoundField DataField="ImageDefault" HeaderText="Hình mặc định" 
                            SortExpression="ImageDefault" />
                        <asp:TemplateField ShowHeader="False">
                            <EditItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                    CommandName="Update" Text="Update"></asp:LinkButton>
                                &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                    CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Button ID="LinkButton1" runat="server" CausesValidation="False" 
                                    CommandName="Edit" Text="Sửa" CssClass="exclusive"></asp:Button>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Fields>
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="#CCCCCC" />
                </asp:DetailsView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                    
                    SelectCommand="SELECT * FROM [VI_TRI_QUANG_CAO] WHERE ([MaViTri] = @MaViTri)" 
                    ConflictDetection="CompareAllValues" 
                    DeleteCommand="DELETE FROM [VI_TRI_QUANG_CAO] WHERE [MaViTri] = @original_MaViTri AND (([TenLoaiViTri] = @original_TenLoaiViTri) OR ([TenLoaiViTri] IS NULL AND @original_TenLoaiViTri IS NULL)) AND (([Width] = @original_Width) OR ([Width] IS NULL AND @original_Width IS NULL)) AND (([Heigth] = @original_Heigth) OR ([Heigth] IS NULL AND @original_Heigth IS NULL)) AND (([ThoiGianLuanChuyen] = @original_ThoiGianLuanChuyen) OR ([ThoiGianLuanChuyen] IS NULL AND @original_ThoiGianLuanChuyen IS NULL)) AND (([TienQuangCao] = @original_TienQuangCao) OR ([TienQuangCao] IS NULL AND @original_TienQuangCao IS NULL)) AND (([Deleted] = @original_Deleted) OR ([Deleted] IS NULL AND @original_Deleted IS NULL))" 
                    InsertCommand="INSERT INTO [VI_TRI_QUANG_CAO] ([TenLoaiViTri], [Width], [Heigth], [ThoiGianLuanChuyen], [TienQuangCao], [Deleted]) VALUES (@TenLoaiViTri, @Width, @Heigth, @ThoiGianLuanChuyen, @TienQuangCao, @Deleted)" 
                    OldValuesParameterFormatString="original_{0}" 
                    UpdateCommand="UPDATE [VI_TRI_QUANG_CAO] SET [TenLoaiViTri] = @TenLoaiViTri, [Width] = @Width, [Heigth] = @Heigth, [ThoiGianLuanChuyen] = @ThoiGianLuanChuyen, [TienQuangCao] = @TienQuangCao, [Deleted] = @Deleted WHERE [MaViTri] = @original_MaViTri AND (([TenLoaiViTri] = @original_TenLoaiViTri) OR ([TenLoaiViTri] IS NULL AND @original_TenLoaiViTri IS NULL)) AND (([Width] = @original_Width) OR ([Width] IS NULL AND @original_Width IS NULL)) AND (([Heigth] = @original_Heigth) OR ([Heigth] IS NULL AND @original_Heigth IS NULL)) AND (([ThoiGianLuanChuyen] = @original_ThoiGianLuanChuyen) OR ([ThoiGianLuanChuyen] IS NULL AND @original_ThoiGianLuanChuyen IS NULL)) AND (([TienQuangCao] = @original_TienQuangCao) OR ([TienQuangCao] IS NULL AND @original_TienQuangCao IS NULL)) AND (([Deleted] = @original_Deleted) OR ([Deleted] IS NULL AND @original_Deleted IS NULL))">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DropDownList1" DefaultValue="0" Name="MaViTri" 
                            PropertyName="SelectedValue" Type="Int32" />
                    </SelectParameters>
                    <DeleteParameters>
                        <asp:Parameter Name="original_MaViTri" Type="Int32" />
                        <asp:Parameter Name="original_TenLoaiViTri" Type="String" />
                        <asp:Parameter Name="original_Width" Type="Int32" />
                        <asp:Parameter Name="original_Heigth" Type="Int32" />
                        <asp:Parameter Name="original_ThoiGianLuanChuyen" Type="Int32" />
                        <asp:Parameter Name="original_TienQuangCao" Type="Decimal" />
                        <asp:Parameter Name="original_Deleted" Type="Boolean" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="TenLoaiViTri" Type="String" />
                        <asp:Parameter Name="Width" Type="Int32" />
                        <asp:Parameter Name="Heigth" Type="Int32" />
                        <asp:Parameter Name="ThoiGianLuanChuyen" Type="Int32" />
                        <asp:Parameter Name="TienQuangCao" Type="Decimal" />
                        <asp:Parameter Name="Deleted" Type="Boolean" />
                        <asp:Parameter Name="original_MaViTri" Type="Int32" />
                        <asp:Parameter Name="original_TenLoaiViTri" Type="String" />
                        <asp:Parameter Name="original_Width" Type="Int32" />
                        <asp:Parameter Name="original_Heigth" Type="Int32" />
                        <asp:Parameter Name="original_ThoiGianLuanChuyen" Type="Int32" />
                        <asp:Parameter Name="original_TienQuangCao" Type="Decimal" />
                        <asp:Parameter Name="original_Deleted" Type="Boolean" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="TenLoaiViTri" Type="String" />
                        <asp:Parameter Name="Width" Type="Int32" />
                        <asp:Parameter Name="Heigth" Type="Int32" />
                        <asp:Parameter Name="ThoiGianLuanChuyen" Type="Int32" />
                        <asp:Parameter Name="TienQuangCao" Type="Decimal" />
                        <asp:Parameter Name="Deleted" Type="Boolean" />
                    </InsertParameters>
                </asp:SqlDataSource>
                
            </asp:Panel>
             </ContentTemplate>
            </asp:UpdatePanel>
        </td>
    </tr>
    <tr>
        <td colspan="5" align="center">
            <asp:UpdatePanel ID="UpdatePanel4" runat="server">
            <ContentTemplate>
            <asp:Panel runat="server" ID="pnlThemLoaiQuangCao" Visible="False" HorizontalAlign="Center">
            <table cellspacing="0" cellpadding="3" rules="cols" border="1" 
                    id="QuanLyQuangCao1_DetailsView1" 
                    style="color:Black;background-color:White;border-color:#999999;border-width:1px;border-style:Solid;height:50px;width:336px;border-collapse:collapse; left: 0px;">

				<tr >

					<td>Tên vị trí quảng cáo</td><td>
                        <asp:TextBox ID="txtTenViTri" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="txtTenViTri" ErrorMessage="*" ValidationGroup="Them"></asp:RequiredFieldValidator>
                    </td>

				</tr><tr style="background-color:#CCCCCC;">

					<td>Width</td><td>
                        <asp:TextBox ID="txtWidth" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="txtWidth" ErrorMessage="*" ValidationGroup="Them"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                            ControlToValidate="txtWidth" ErrorMessage="Phải là số" 
                            ValidationExpression="[0-9]{1,5}" ValidationGroup="Them">*</asp:RegularExpressionValidator>
                    </td>

				</tr><tr>

					<td>Heigth</td><td> <asp:TextBox ID="txtHeight" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="txtHeight" ErrorMessage="*" ValidationGroup="Them"></asp:RequiredFieldValidator>
                    </td>

				</tr><tr style="background-color:#CCCCCC;">

					<td>Thời gian luân chuyển</td><td> <asp:TextBox ID="txtThoiGianLuanChuyen" runat="server"></asp:TextBox></td>

				</tr><tr >

					<td>Tiền quảng cáo</td><td> <asp:TextBox ID="txtTienQuangCao" runat="server"></asp:TextBox></td>

				</tr><tr style="background-color:#CCCCCC;">

					<td>Deleted</td><td><span title="Deleted">
                        <asp:CheckBox ID="ckDeleted" runat="server" /></span></td>
                    </tr><tr >

					<td>Hình ảnh mặc định</td><td> <asp:TextBox ID="txtImage" runat="server"></asp:TextBox></td>

				
				</tr><tr >

					<td colspan="2">
                        <asp:Button ID="btnThem" runat="server" Text="Thêm" onclick="btnThem_Click1" 
                            ValidationGroup="Them" CssClass="exclusive"/></td>

				</tr>
                 
			</table>

</asp:Panel>


   </ContentTemplate>
            </asp:UpdatePanel>
            
        </td>
    </tr>
    </table>
    
    <br />
<br />
<br />
<br />
        
    <table border="1" cellspacing="0" cellpadding="0" width="100%">
    	<tr >
    	<td colspan="5" style="color: #FFFFFF; background-color: #7D7D7D; font-style: normal; font-weight: bold; font-size: x-large" align="center"> Quản lý các banner</td>
    	</tr>
    	    <tr>
        <td colspan="5" align="center">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
            <ContentTemplate>
           
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="MaQuangCao" DataSourceID="SqlDataSource2" 
                   onselectedindexchanged="GridView1_SelectedIndexChanged">
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                            CommandName="Update" Text="Update"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Sửa" 
                            ToolTip='<%# Eval("MaQuangCao", "{0}") %>' />
                        &nbsp;
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="MaKhachHang" HeaderText="MaKhachHang" 
                    SortExpression="MaKhachHang" Visible="False" />
                <asp:BoundField DataField="MaLoaiQuangCao" HeaderText="MaLoaiQuangCao" 
                    SortExpression="MaLoaiQuangCao" Visible="False" />
                <asp:BoundField DataField="MaQuangCao" HeaderText="MaQuangCao" 
                    InsertVisible="False" ReadOnly="True" SortExpression="MaQuangCao" 
                    Visible="False" />
                <asp:BoundField DataField="TenQuangCao" HeaderText="Tên quảng cáo" 
                    SortExpression="TenQuangCao" />
                <asp:BoundField DataField="NavigateUrl" HeaderText="NavigateUrl" 
                    SortExpression="NavigateUrl" />
                <asp:BoundField DataField="ThoiGianDang" HeaderText="Thời gian bắt đầu" 
                    SortExpression="ThoiGianDang" DataFormatString="{0:d}" />
                <asp:BoundField DataField="ThoiGianHetHan" HeaderText="Thời gian kết thúc" 
                    SortExpression="ThoiGianHetHan" DataFormatString="{0:d}" />
                <asp:BoundField DataField="NoiDungQuangCao" HeaderText="Nội dung quảng cáo" 
                    SortExpression="NoiDungQuangCao" />
                <asp:CheckBoxField DataField="Deleted" HeaderText="Deleted" 
                    SortExpression="Deleted" />
                <asp:BoundField DataField="ThoiGianAnhDong" HeaderText="Thời gian ảnh động" 
                    SortExpression="ThoiGianAnhDong" />
                <asp:BoundField DataField="ImageUrl" HeaderText="ImageUrl" 
                    SortExpression="ImageUrl" />
                <asp:BoundField DataField="Height" HeaderText="Height" 
                    SortExpression="Height" />
                <asp:BoundField DataField="Width" HeaderText="Width" SortExpression="Width" />
                <asp:BoundField DataField="MaViTri" HeaderText="MaViTri" 
                    SortExpression="MaViTri" Visible="False" />
            </Columns>
            <EmptyDataTemplate>
                Không có quảng nào ở vị trí đã chọn
            </EmptyDataTemplate>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString6 %>" 
            DeleteCommand="DELETE FROM [QUANG_CAO] WHERE [MaQuangCao] = @original_MaQuangCao" 
            InsertCommand="INSERT INTO [QUANG_CAO] ([MaLoaiQuangCao], [MaKhachHang], [TenQuangCao], [NavigateUrl], [ThoiGianDang], [Width], [Height], [ImageUrl], [ThoiGianAnhDong], [Deleted], [NoiDungQuangCao], [ThoiGianHetHan], [MaViTri]) VALUES (@MaLoaiQuangCao, @MaKhachHang, @TenQuangCao, @NavigateUrl, @ThoiGianDang, @Width, @Height, @ImageUrl, @ThoiGianAnhDong, @Deleted, @NoiDungQuangCao, @ThoiGianHetHan, @MaViTri)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT [MaQuangCao], [MaLoaiQuangCao], [MaKhachHang], [TenQuangCao], [NavigateUrl], [ThoiGianDang], [Width], [Height], [ImageUrl], [ThoiGianAnhDong], [Deleted], [NoiDungQuangCao], [ThoiGianHetHan], [MaViTri] FROM [QUANG_CAO] WHERE ([MaViTri] = @MaViTri)" 
            
                   UpdateCommand="UPDATE [QUANG_CAO] SET [MaLoaiQuangCao] = @MaLoaiQuangCao, [MaKhachHang] = @MaKhachHang, [TenQuangCao] = @TenQuangCao, [NavigateUrl] = @NavigateUrl, [ThoiGianDang] = @ThoiGianDang, [Width] = @Width, [Height] = @Height, [ImageUrl] = @ImageUrl, [ThoiGianAnhDong] = @ThoiGianAnhDong, [Deleted] = @Deleted, [NoiDungQuangCao] = @NoiDungQuangCao, [ThoiGianHetHan] = @ThoiGianHetHan, [MaViTri] = @MaViTri WHERE [MaQuangCao] = @original_MaQuangCao" 
                   
                ProviderName="<%$ ConnectionStrings:RAOVATConnectionString6.ProviderName %>">
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" DefaultValue="0" Name="MaViTri" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="original_MaQuangCao" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="MaLoaiQuangCao" Type="Int32" />
                <asp:Parameter Name="MaKhachHang" Type="Int32" />
                <asp:Parameter Name="TenQuangCao" Type="String" />
                <asp:Parameter Name="NavigateUrl" Type="String" />
                <asp:Parameter DbType="Date" Name="ThoiGianDang" />
                <asp:Parameter Name="Width" Type="Int32" />
                <asp:Parameter Name="Height" Type="Int32" />
                <asp:Parameter Name="ImageUrl" Type="String" />
                <asp:Parameter Name="ThoiGianAnhDong" Type="Int32" />
                <asp:Parameter Name="Deleted" Type="Boolean" />
                <asp:Parameter Name="NoiDungQuangCao" Type="String" />
                <asp:Parameter Name="ThoiGianHetHan" DbType="Date" />
                <asp:Parameter Name="MaViTri" Type="Int32" />
                <asp:Parameter Name="original_MaQuangCao" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="MaLoaiQuangCao" Type="Int32" />
                <asp:Parameter Name="MaKhachHang" Type="Int32" />
                <asp:Parameter Name="TenQuangCao" Type="String" />
                <asp:Parameter Name="NavigateUrl" Type="String" />
                <asp:Parameter DbType="Date" Name="ThoiGianDang" />
                <asp:Parameter Name="Width" Type="Int32" />
                <asp:Parameter Name="Height" Type="Int32" />
                <asp:Parameter Name="ImageUrl" Type="String" />
                <asp:Parameter Name="ThoiGianAnhDong" Type="Int32" />
                <asp:Parameter Name="Deleted" Type="Boolean" />
                <asp:Parameter Name="NoiDungQuangCao" Type="String" />
                <asp:Parameter Name="ThoiGianHetHan" DbType="Date" />
                <asp:Parameter Name="MaViTri" Type="Int32" />
            </InsertParameters>
        </asp:SqlDataSource>
        </ContentTemplate>
            </asp:UpdatePanel>
        </td>
    </tr>
    <tr>
    <td colspan ="5" align="center">
        <asp:Panel ID="pnlInsertQuangCaoButton" runat="server" HorizontalAlign="Left">
            <asp:Button ID="btnThemQuangCao" runat="server" Text="Hiện thêm quảng cáo" 
                onclick="btnThemQuangCao_Click" CssClass="exclusive" />
        </asp:Panel>
        <asp:Panel ID="pnlInsertQuangCao" runat="server" Visible="false" HorizontalAlign="Center">
          <asp:Panel runat="server" ID="sfsd" HorizontalAlign="Left">
                    <asp:Button ID="Button2" runat="server" Text="Ẩn thêm quảng cáo" onclick="LinkButton2_Click" CssClass="exclusive"/>
                </asp:Panel>
            <asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" 
                DataKeyNames="MaQuangCao" DataSourceID="SqlDataSource2" DefaultMode="Insert" 
                Height="50px" onpageindexchanging="DetailsView2_PageIndexChanging" 
                Width="368px">
                <FooterTemplate>
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                        ValidationGroup="ThemQuangCao" />
                </FooterTemplate>
                <Fields>
                    <asp:TemplateField HeaderText="MaKhachHang" SortExpression="MaKhachHang">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox11" runat="server" Text='<%# Bind("MaKhachHang") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:DropDownList ID="DropDownList3" runat="server" 
                                DataSourceID="SqlDataSource6" DataTextField="TenCongTy" 
                                DataValueField="MaKhachHang">
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenCongTy], [MaKhachHang] FROM [KHACH_HANG_QUANG_CAO] WHERE ([Deleted] = @Deleted)">
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="false" Name="Deleted" Type="Boolean" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label10" runat="server" Text='<%# Bind("MaKhachHang") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="MaLoaiQuangCao" SortExpression="MaLoaiQuangCao">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox10" runat="server" Text='<%# Bind("MaLoaiQuangCao") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:DropDownList ID="DropDownList2" runat="server" 
                                DataSourceID="SqlDataSource5" DataTextField="TenLoaiQuangCao" 
                                DataValueField="MaLoaiQuangCao">
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                                SelectCommand="SELECT [TenLoaiQuangCao], [MaLoaiQuangCao] FROM [LOAI_QUANG_CAO] WHERE ([Deleted] = @Deleted) ORDER BY [MaLoaiQuangCao]">
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="false" Name="Deleted" Type="Boolean" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </InsertItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="MaQuangCao" InsertVisible="False" 
                        SortExpression="MaQuangCao">
                        <EditItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("MaQuangCao") %>'></asp:Label>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label11" runat="server" Text='<%# Bind("MaQuangCao") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="TenQuangCao" SortExpression="TenQuangCao">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TenQuangCao") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TenQuangCao") %>'></asp:TextBox>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("TenQuangCao") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="NavigateUrl" SortExpression="NavigateUrl">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("NavigateUrl") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("NavigateUrl") %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                ControlToValidate="TextBox2" ErrorMessage="Nhập link liên kết" 
                                ValidationGroup="ThemQuangCao">*</asp:RequiredFieldValidator>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("NavigateUrl") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ThoiGianDang" SortExpression="ThoiGianDang">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("ThoiGianDang") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:CalendarExtender ID="CalendarExtender1" runat="server" 
                                TargetControlID="TextBox3">
                            </asp:CalendarExtender>
                            <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("ThoiGianDang") %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                                ControlToValidate="TextBox3" ErrorMessage="Nhập thời gian đăng" 
                                ValidationGroup="ThemQuangCao">*</asp:RequiredFieldValidator>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("ThoiGianDang") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ThoiGianHetHan" SortExpression="ThoiGianHetHan">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("ThoiGianHetHan") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:CalendarExtender ID="CalendarExtender2" runat="server" 
                                TargetControlID="TextBox4">
                            </asp:CalendarExtender>
                            <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("ThoiGianHetHan") %>'></asp:TextBox>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label4" runat="server" Text='<%# Bind("ThoiGianHetHan") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="NoiDungQuangCao" 
                        SortExpression="NoiDungQuangCao">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("NoiDungQuangCao") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("NoiDungQuangCao") %>'></asp:TextBox>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label5" runat="server" Text='<%# Bind("NoiDungQuangCao") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Deleted" SortExpression="Deleted">
                        <EditItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Deleted") %>' />
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Deleted") %>' />
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Deleted") %>' 
                                Enabled="false" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ThoiGianAnhDong" 
                        SortExpression="ThoiGianAnhDong">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("ThoiGianAnhDong") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("ThoiGianAnhDong") %>'></asp:TextBox>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label6" runat="server" Text='<%# Bind("ThoiGianAnhDong") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ImageUrl" SortExpression="ImageUrl">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("ImageUrl") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("ImageUrl") %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                                ControlToValidate="TextBox7" ErrorMessage="Nhập thời gian đăng" 
                                ValidationGroup="ThemQuangCao">*</asp:RequiredFieldValidator>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label7" runat="server" Text='<%# Bind("ImageUrl") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Height" SortExpression="Height">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("Height") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("Height") %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                                ControlToValidate="TextBox9" ErrorMessage="Nhập Height" 
                                ValidationGroup="ThemQuangCao">*</asp:RequiredFieldValidator>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label9" runat="server" Text='<%# Bind("Height") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Width" SortExpression="Width">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("Width") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("Width") %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                                ControlToValidate="TextBox8" ErrorMessage="Nhập Width" 
                                ValidationGroup="ThemQuangCao">*</asp:RequiredFieldValidator>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label8" runat="server" Text='<%# Bind("Width") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="MaViTri" HeaderText="MaViTri" ReadOnly="True" 
                        SortExpression="MaViTri" Visible="False" />
                    <asp:TemplateField ShowHeader="False">
                        <InsertItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                onclick="LinkButton1_Click1" Text="Thêm" ValidationGroup="ThemQuangCao"></asp:LinkButton>
                            &nbsp;&nbsp;
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                CommandName="New" Text="New"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Fields>
            </asp:DetailsView>
        </asp:Panel>
        <asp:SqlDataSource ID="SqlDataSource4" runat="server"></asp:SqlDataSource>
        </td>
    </tr>
    <tr>
    <td colspan="3" align="center">
        <asp:UpdatePanel ID="UpdatePanel5" runat="server">
        <ContentTemplate>
        <asp:Panel ID="pnlEdit" runat="server" HorizontalAlign="Center" Visible="false">
         <asp:Panel runat="server" ID="Panel1" HorizontalAlign="Left" >
                    <asp:Button ID="Button3" runat="server" Text="Ẩn sửa quảng cáo" 
                        onclick="Button3_Click1" CssClass="exclusive" />
                </asp:Panel>
        <asp:DetailsView ID="DetailsView3" runat="server" AutoGenerateRows="False" 
            DataKeyNames="MaQuangCao"  DefaultMode="Edit" 
            Height="50px" Width="368px">
            <FooterTemplate>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                    ValidationGroup="EditQuangCao" />
            </FooterTemplate>
            <Fields>
                <asp:TemplateField HeaderText="MaKhachHang" SortExpression="MaKhachHang">
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownList3" runat="server" 
                            DataSourceID="SqlDataSource6" DataTextField="TenCongTy" 
                            DataValueField="MaKhachHang">
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                            SelectCommand="SELECT [TenCongTy], [MaKhachHang] FROM [KHACH_HANG_QUANG_CAO] WHERE ([Deleted] = @Deleted)">
                            <SelectParameters>
                                <asp:Parameter DefaultValue="false" Name="Deleted" Type="Boolean" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label10" runat="server" Text='<%# Bind("MaKhachHang") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="MaLoaiQuangCao" SortExpression="MaLoaiQuangCao">
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownList2" runat="server" 
                            DataSourceID="SqlDataSource5" DataTextField="TenLoaiQuangCao" 
                            DataValueField="MaLoaiQuangCao">
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
                            SelectCommand="SELECT [TenLoaiQuangCao], [MaLoaiQuangCao] FROM [LOAI_QUANG_CAO] WHERE ([Deleted] = @Deleted) ORDER BY [MaLoaiQuangCao]">
                            <SelectParameters>
                                <asp:Parameter DefaultValue="false" Name="Deleted" Type="Boolean" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="MaQuangCao" InsertVisible="False" 
                    SortExpression="MaQuangCao">
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("MaQuangCao") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label11" runat="server" Text='<%# Bind("MaQuangCao") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="TenQuangCao" SortExpression="TenQuangCao">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TenQuangCao") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TenQuangCao") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("TenQuangCao") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="NavigateUrl" SortExpression="NavigateUrl">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("NavigateUrl") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                            ControlToValidate="TextBox2" ErrorMessage="Nhập link liên kết" 
                            ValidationGroup="EditQuangCao">*</asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("NavigateUrl") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("NavigateUrl") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ThoiGianDang" SortExpression="ThoiGianDang">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("ThoiGianDang") %>'></asp:TextBox>
                        <asp:CalendarExtender ID="CalendarExtender1" runat="server" 
                            TargetControlID="TextBox3">
                        </asp:CalendarExtender>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                            ControlToValidate="TextBox3" ErrorMessage="Nhập thời gian đăng" 
                            ValidationGroup="EditQuangCao">*</asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("ThoiGianDang") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ThoiGianHetHan" SortExpression="ThoiGianHetHan">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("ThoiGianHetHan") %>'></asp:TextBox>
                        <asp:CalendarExtender ID="CalendarExtender2" runat="server" 
                            TargetControlID="TextBox4">
                        </asp:CalendarExtender>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("ThoiGianHetHan") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="NoiDungQuangCao" 
                    SortExpression="NoiDungQuangCao">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("NoiDungQuangCao") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("NoiDungQuangCao") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("NoiDungQuangCao") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Deleted" SortExpression="Deleted">
                    <EditItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Deleted") %>' />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Deleted") %>' />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("Deleted") %>' 
                            Enabled="false" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ThoiGianAnhDong" 
                    SortExpression="ThoiGianAnhDong">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("ThoiGianAnhDong") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("ThoiGianAnhDong") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label6" runat="server" Text='<%# Bind("ThoiGianAnhDong") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ImageUrl" SortExpression="ImageUrl">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("ImageUrl") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                            ControlToValidate="TextBox7" ErrorMessage="Nhập thời gian đăng" 
                            ValidationGroup="EditQuangCao">*</asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("ImageUrl") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label7" runat="server" Text='<%# Bind("ImageUrl") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Height" SortExpression="Height">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("Height") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                            ControlToValidate="TextBox9" ErrorMessage="Nhập Height" 
                            ValidationGroup="EditQuangCao">*</asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("Height") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label9" runat="server" Text='<%# Bind("Height") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Width" SortExpression="Width">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("Width") %>'></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                            ControlToValidate="TextBox8" ErrorMessage="Nhập Width" 
                            ValidationGroup="EditQuangCao">*</asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("Width") %>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label8" runat="server" Text='<%# Bind("Width") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="ThoiGianAnhDong" HeaderText="ThoiGianAnhDong" 
                    SortExpression="ThoiGianAnhDong" />
                <asp:TemplateField ShowHeader="False">
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                            onclick="LinkButton1_Click" Text="Edit" ValidationGroup="EditQuangCao"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            onclick="Button4_Click" Text="Delete"></asp:LinkButton>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        &nbsp;
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                            CommandName="New" Text="New"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Fields>
        </asp:DetailsView>
            <br />
        
        </asp:Panel>
        </ContentTemplate>
        </asp:UpdatePanel>
    </td></tr>
</table>